﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MvcDemo.Filter
{
    /// <summary>
    /// 自定义动作过滤器
    /// </summary>
    public class CustomResultFilter : ActionFilterAttribute
    {
        /// <summary>
        /// 加载“视图”前执行
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnResultExecuting(ResultExecutingContext filterContext)
        {
            filterContext.HttpContext.Response.Write("加载视图前执行 OnResultExecuting<br/>");
            base.OnResultExecuting(filterContext);
        }

        /// <summary>
        /// 加载“视图”后执行
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            filterContext.HttpContext.Response.Write("加载视图后执行 OnResultExecuted<br/>");
            base.OnResultExecuted(filterContext);
        }
    }
}